<template>
	<view class="news-detail">
		<view class="title">{{detail.title}}</view>
		<view class="info">
			<text>发表时间：{{detail.add_time|getTime}}</text>
			<text>浏览：{{detail.click}}</text>
		</view>
		<view class="content">
			<!-- rich-text解析html标签，:node -->
			<rich-text :nodes="detail.content"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:0,
				detail:{}
			}
		},
		methods: {
			
			async getNewsDetail(){
				const res=await this.$myRequest({
					url:'/api/getnew/'+this.id
				})
				console.log(res)
				this.detail=res.data.message[0]
			}
		},
		onLoad(options){
			console.log(options)
			this.id=options.id
			this.getNewsDetail();
		},
	}
</script>

<style>
	.news-detail{
		font-size: 30rpx;
		padding:0 20rpx;
	}	
		.title{
			text-align: center;
			font-weight: bold;
			margin: 20rpx 0;
		}
		.info{
			font-size: 26rpx;
			color: #666;
			margin-top: 50rpx;
			display: flex;
			justify-content: space-between;
		}
		.content{
			text-indent:2em;
			margin-top:40rpx;
			line-height: 50rpx;
		}
	
	
</style>
